package com.amoyhong.hongWhether.utils;

import android.content.Context;
import android.content.SharedPreferences;

import com.amoyhong.hongWhether.MyApplication;
import com.amoyhong.hongWhether.R;

/**
 * Created by Administrator on 2016/5/31.
 */
public class ThemeUtil {

    public static void saveThemeId(int themeId) {

        SharedPreferences preferences = MyApplication.getInstance().getSharedPreferences("Hong_weather", Context.MODE_PRIVATE);
        preferences.edit().putInt("theme_id", themeId).commit();

    }


    public static int getThemeId() {

        SharedPreferences preferences = MyApplication.getInstance().getSharedPreferences("Hong_weather", Context.MODE_PRIVATE);
        return preferences.getInt("theme_id", R.style.AppTheme);

    }

    public static void switchTheme(){
        if (getThemeId() == R.style.AppTheme) {
            saveThemeId(R.style.AppTheme_green);
        } else {
            saveThemeId(R.style.AppTheme);
        }
    }

}
